package com.usian.controller;

import com.usian.api.admin.SensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.service.SensitiveService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RequestMapping("/api/v1/sensitive")
@RestController
public class SensitiveController implements SensitiveControllerApi {


    @Autowired
    private SensitiveService sensitiveService;

    @Override
    @PostMapping("list")
    @ApiOperation(value = "查询")
    public ResponseResult list(SensitiveDto dto) {
        return sensitiveService.list(dto);
    }

    @Override
    @PostMapping("save")
    @ApiOperation(value = "添加")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.insert(adSensitive);
    }

    @Override
    @PostMapping("update")
    @ApiOperation(value = "修改")

    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.update(adSensitive);
    }

    @Override
    @PostMapping("delete/{id}")
    @ApiOperation(value = "删除")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return sensitiveService.delete(id);
    }
}
